<?php

App::uses('AppModel', 'Model');

class Usuario extends AppModel {

    public $name = 'Usuario';
    public $useTable = "AUTORIZADO";
    public $id = 'CD_LOGIN';
    public $primaryKey = 'CD_LOGIN';
    public $validate = array(
        'CD_LOGIN' => array(
            'unique' => true,
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Informe o Login',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'NM_AUT' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Informe o Nome',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'STATUS' => array(
            'notempty' => array(
                'rule' => array('notempty'),
            //'message' => 'Your custom message here',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'SENHA' => array(
            'required' => array(
                'rule' => array('custom', '/[a-z0-9]{8,}$/i'),
                'message' => 'Apenas letras e números, mínimo de 8 caracteres',
            ),
        ),
        'SEXO' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Informe o Sexo',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'DS_EMAIL' => array(
            'email' => array(
                'rule' => array('email'),
                'message' => 'Informe o Email',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
            'notempty' => array(
                'rule' => array('notempty'))
        )
//            ,'IM_FOTO' => array(
//                    'rule' => 'uploadError',
//                    'message' => 'Erro no Envio do arquivo.'
//                    ),
    );
    public $hasMany = array(
        'Telefone' => array(
            'className' => 'Telefone',
            'foreignKey' => 'CD_LOGIN'
//                    ,	'dependent' => false,
//			'conditions' => '',
//			'fields' => '',
//			'order' => '',
//			'limit' => '',
//			'offset' => '',
//			'exclusive' => '',
//			'finderQuery' => '',
//			'counterQuery' => ''
        ),
        'RelacionamentoAutoPerfilInst' => array(
            'className' => 'RelacionamentoAutoPerfilInst',
            'foreignKey' => 'CD_LOGIN'
//                    ,	'dependent' => false,
//			'conditions' => '',
//			'fields' => '',
//			'order' => '',
//			'limit' => '',
//			'offset' => '',
//			'exclusive' => '',
//			'finderQuery' => '',
//			'counterQuery' => ''
        )
    );

}